﻿@model RTW.OA.Models.position
@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_LayoutBase.cshtml";
}

@section styles{

}
<div id="dMain">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="ibox" style="margin-bottom: 0px;">
            <div class="ibox-title">
                <h4>@ViewBag.Title </h4>
            </div>
            <div class="ibox-content">
                @using (Html.BeginForm("Edit", "Position", FormMethod.Post, new { area = "System", id = "systemfrom", name = "systemfrom" }))
                {
                    @Html.AntiForgeryToken()
                    @Html.HiddenFor(model => model.POSITION_ID)
                    @Html.HiddenFor(model => model.FUNC_ID_STR)
                    <div class="from-content">
                        <dl>
                            <dt>所属部门</dt>
                            <dd>
                                <div class="rule-single-select">
                                    @Html.DropDownListFor(model => model.POSITION_DEPT_ID, ViewBag.TreeData as List<SelectListItem>, new { @Class = "form-control", datatype = "*", sucmsg = " " })
                                </div>
                            </dd>
                        </dl>
                        <dl>
                            <dt>职务名称</dt>
                            <dd>

                                @Html.EditorFor(model => model.POSITION_NAME, new { htmlAttributes = new { @class = "input normal form-control", datatype = "*2-100", sucmsg = " " } })
                            </dd>
                        </dl>
                        <dl>
                            <dt>职务代码</dt>
                            <dd>
                                @Html.EditorFor(model => model.POSITION_NO, new { htmlAttributes = new { @class = "input normal form-control", datatype = "*2-100", sucmsg = " " } })
                            </dd>
                        </dl>

                        <dl>
                            <dt>全局职务</dt>
                            <dd>
                                <div class="rule-single-checkbox">
                                    @Html.CheckBoxFor(model => model.IS_GLOBAL, new { @class = "form-control" })
                                </div>
                            </dd>
                        </dl>
                        <dl>
                            <dt>管理权限</dt>
                            <dd>
                                <div class="rule-multi-radio">
                                    <ul>
                                        <li>
                                            <input type="radio" name="POSITION_TYPE" value="P" /><label>个人</label>
                                            <input type="radio" name="POSITION_TYPE" value="S" /><label>个人及下属</label>
                                            <input type="radio" name="POSITION_TYPE" value="D" /><label>部门</label>
                                            <input type="radio" name="POSITION_TYPE" value="B" /><label>分院</label>
                                            <input type="radio" name="POSITION_TYPE" value="O" onclick="addDataright()" /><label>自选</label>
                                        </li>
                                    </ul>
                                </div>
                            </dd>
                        </dl>
                    </div>
                    <div class="from-footer">
                        <div class="btn-wrap" style="position: fixed;" onclick="savefrom()">
                            <a class="btn btn-sm btn-primary radius">
                                <i class="iconfont icon-save"></i>
                                提交保存
                            </a>
                            <a class="btn btn-sm btn-warning radius" onclick="parent.subcloseTab('8001')">
                                <i class="iconfont icon-fanhui"></i>
                                取消关闭
                            </a>
                        </div>
                    </div>
                }
            </div>
        </div>
    </div>
</div>
@section scripts{
    <script src="@Url.Content("~/Content/JS/common/WdatePicker/WdatePicker.js")"></script>
    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/JS/common/jquery/Validform_v5.3.2_min.js")"></script>
    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/JS/common/artdialog/dialog-plus-min.js")"></script>
    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/JS/common/webuploader/webuploader.min.js")"></script>
    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/editor/ueditor.config.js")"></script>
    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/editor/ueditor.all.min.js")"></script>
    <script type="text/javascript" charset="utf-8" src="@Url.Content("~/Content/editor/lang/zh-cn/zh-cn.js")"></script>
    @*<script type="text/javascript" charset="utf-8" src="../js/uploader.js"></script>*@
    <script src="@Url.Content("~/Content/JS/common/from.js")"></script>

    <script>
        $(function () {
            //初始化表单验证
            $("#systemfrom").initValidform();

        });
        function savefrom() {
            $("#systemfrom").submit();
        }

            //初始化分类的结构
            initCategoryHtml('.tree-list', 1);
            //初始化分类的事件
            $('.tree-list').initCategoryTree(true);
            //是否启用权限
            if ($("#ddlRoleType").find("option:selected").attr("value") == 1) {
                $(".tree-list").find("input[type='checkbox']").prop("disabled", true);
            }
            $("#ddlRoleType").change(function () {
                if ($(this).find("option:selected").attr("value") == 1) {
                    $(".tree-list").find("input[type='checkbox']").prop("checked", false);
                    $(".tree-list").find("input[type='checkbox']").prop("disabled", true);
                } else {
                    $(".tree-list").find("input[type='checkbox']").prop("disabled", false);
                }
            });
            //权限全选
            $("input[name='checkAll']").click(function () {
                if ($(this).prop("checked") == true) {
                    $(this).parent().siblings(".col").find("input[type='checkbox']").prop("checked", true);
                } else {
                    $(this).parent().siblings(".col").find("input[type='checkbox']").prop("checked", false);
                }
            });
        function addDataright() {
            var id = $('#FUNC_ID_STR').val();
                layer.open({
                    type: 2,
                    shadeClose: true,
                    shade: 0.8,
                    skin: 'layui-layer-rim', //加上边框
                    area: ['80%', '90%'], //宽高
                    content: '@Url.Action("SelectDataRight", "Position", new { area = "System" })\/' + id
                });
        }

        function getDataright(right) {
            $('#FUNC_ID_STR').val(right);
        }
    </script>
}